bitkeeper revision 1.544 (3fa15259IWpuWetGe_175Hq5izSLnA)
authorach61@labyrinth.cl.cam.ac.uk <ach61@labyrinth.cl.cam.ac.uk>
Thu, 30 Oct 2003 18:03:05 +0000 (18:03 +0000)
committerach61@labyrinth.cl.cam.ac.uk <ach61@labyrinth.cl.cam.ac.uk>
Thu, 30 Oct 2003 18:03:05 +0000 (18:03 +0000)
hypercall jumps to pervasive debugger

.rootkeys
BitKeeper/etc/ignore
xen/common/debug.c [new file with mode: 0644]
xen/common/dom0_ops.c
xen/include/hypervisor-ifs/dom0_ops.h
xen/include/xeno/sched.h

index 0c283bf879f7df71dbaf8830f4ce6b8b6ba94cad..4e753c27ca29828163023d590215c7fa2a95b25d 100644 (file)
--- a/.rootkeys
+++ b/.rootkeys
 3e397e66AyyD5fYraAySWuwi9uqSXg xen/common/ac_timer.c
 3ddb79bddEYJbcURvqqcx99Yl2iAhQ xen/common/block.c
 3ddb79bdrqnW93GR9gZk1OJe1qK-iQ xen/common/brlock.c
+3fa152581E5KhrAtqZef2Sr5NKTz4w xen/common/debug.c
 3ddb79bdLX_P6iB7ILiblRLWvebapg xen/common/dom0_ops.c
 3e6377e4i0c9GtKN65e99OtRbw3AZw xen/common/dom_mem_ops.c
 3ddb79bdYO5D8Av12NHqPeSviav7cg xen/common/domain.c
index 33a9945db7026a596de9019cefab79d6dee534c2..25b9a3bed31bcd181a263b4f7581455f6123da96 100644 (file)
@@ -479,3 +479,4 @@ tools/misc/xen_cpuperf
 tools/misc/xen_log
 tools/misc/xen_refresh_dev
 xenolinux-2.4.22-sparse/arch/xeno/drivers/block/device
+xen/common/debug.c~
diff --git a/xen/common/debug.c b/xen/common/debug.c
new file mode 100644 (file)
index 0000000..c20c5b2
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * debug.c
+ *
+ * xen pervasive debugger
+ */
+
+#include <xeno/config.h>
+#include <xeno/types.h>
+#include <xeno/lib.h>
+#include <hypervisor-ifs/dom0_ops.h>
+#include <xeno/sched.h>
+#include <xeno/event.h>
+
+#define DEBUG_TRACE
+#ifdef DEBUG_TRACE
+#define TRC(_x) _x
+#else
+#define TRC(_x)
+#endif
+
+void pdb_do_debug (dom0_op_t *op)
+{
+    op->u.debug.status = 0;
+    op->u.debug.out1 = op->u.debug.in2 + 10;
+    op->u.debug.out2 = op->u.debug.in1 + 100;
+
+    TRC(printk("PDB: op:%c, dom:%x, in1:%x, in2:%x\n",
+              op->u.debug.opcode, op->u.debug.domain,
+              op->u.debug.in1, op->u.debug.in2));
+
+    if (op->u.debug.domain == 0)
+    {
+        op->u.debug.status = 1;
+       return;
+    }
+
+    switch (op->u.debug.opcode)
+    {
+        case 'r' :
+       {
+           struct task_struct * p = find_domain_by_id(op->u.debug.domain);
+           if ( p != NULL )
+           {
+               if ( (p->flags & PF_CONSTRUCTED) != 0 )
+               {
+                   wake_up(p);
+                   reschedule(p);
+               }
+               put_task_struct(p);
+           }
+           else
+           {
+               op->u.debug.status = 2;                    /* invalid domain */
+           }
+           break;
+       }
+        case 's' :
+       {
+           unsigned long cpu_mask;
+           struct task_struct * p = find_domain_by_id(op->u.debug.domain);
+
+           if (p != NULL)
+           {
+               if (p->state != TASK_SUSPENDED)
+               {
+                   cpu_mask = mark_hyp_event(p, _HYP_EVENT_STOP);
+                   hyp_event_notify(cpu_mask);
+               }
+               put_task_struct(p);
+           }
+           else
+           {
+               op->u.debug.status = 2;                    /* invalid domain */
+           }
+           break;
+       }
+        default :
+       {
+           printk("PDB error: unknown debug opcode %c (0x%x)\n",
+                  op->u.debug.opcode, op->u.debug.opcode);
+       }
+    }
+    return;
+}
index d5d5e278f1ab045af11b7c29ac81393e1d661887..1356583bdda851509c94841b654ab7331b650a26 100644 (file)
@@ -310,8 +310,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
 
     case DOM0_DEBUG:
     {
-        op.u.debug.out1 = op.u.debug.in2 + 1;
-        op.u.debug.out2 = op.u.debug.in1 + 1;
+        pdb_do_debug(&op);
         copy_to_user(u_dom0_op, &op, sizeof(op));
         ret = 0;
     }
index 55544e162696ba2b042348cbd8caafcf3b41675f..c5c4f97298ed9d1bac65f45facc9dbfc248aa364 100644 (file)
@@ -106,16 +106,15 @@ typedef struct dom0_msr_st
     unsigned int in1, in2;
     /* OUT variables. */
     unsigned int out1, out2;
-
 } dom0_msr_t;
 
 typedef struct dom0_debug_st
 {
     /* IN variables. */
-    int in1, in2;
+    char opcode;
+    int domain, in1, in2;
     /* OUT variables. */
-    int out1, out2;
-
+    int status, out1, out2;
 } dom0_debug_t;
 
 /*
index bd517f9e977a9946bf4a3d0defdc74ee51f5a604..b15007240645ae65f4256366c8ac71eb433be07c 100644 (file)
@@ -171,7 +171,7 @@ struct task_struct
  * TASK_UNINTERRUPTIBLE: Domain is blocked but may not be woken up by an
  *                       arbitrary event or timer.
  * TASK_WAIT:            Domains CPU allocation expired.
- * TASK_SUSPENDED:       Domain is in supsended state (eg. start of day)
+ * TASK_SUSPENDED:       Domain is suspended (startofday or pervasive debugger)
  * TASK_DYING:           Domain is about to cross over to the land of the dead.
  *
  * If you update these then please update the mapping to text names in